<?php
$pid = $_POST['pid'];
include ("conn.php");
//拿到作者id
$sql="SELECT count(*) FROM collection WHERE pid=".$pid;
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$sum = (int)$row['count(*)'];
echo '{"num":'.$sum.'}';
?>